﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _1ExtensionMethods
{
    public static class StringBuilderExt
    {
        public static StringBuilder Substring(this StringBuilder sb, int index, int length)
        {
            if (index > sb.Length)
            {
                throw new IndexOutOfRangeException("Starting index of substring is out of range");
            }
            string strSb = sb.ToString();
            StringBuilder subStr = new StringBuilder();
            subStr.Append(strSb.Substring(index, length));
            return subStr;
        }
    }
}
